const path = require("path");
const gulp = require("gulp");
const less = require("gulp-less");
const concat = require("gulp-concat");

const dist = path.resolve(__dirname, "public");

const ispx = process.argv.splice(2)[0] === "--px";
const name = ispx ? "index.css" : "mobile.css";
gulp.task("less", () =>
	gulp
		.src(`./src/*.less`)
		.pipe(
			less({
				modifyVars: {
					"@px": ispx ? "1rem" : "1px",
				},
			})
		)
		.pipe(concat(name))
		.pipe(gulp.dest(dist))
);
const build = gulp.series("less");

build();
console.log("over");
